package io;

import java.io.*;

public class PWDemo2 {
    public static void main(String[] args) throws IOException {
        //低级流 负责向文件中写入字节
        FileOutputStream fos = new FileOutputStream("pw2.txt");
        //转换流（高级流） 负责衔接字符与字节流，将写出的字符转换为字节
        OutputStreamWriter osw = new OutputStreamWriter(fos,"UTF-8");
        //缓冲流（高级流），负责快写文本数据加速
        BufferedWriter bw = new BufferedWriter(osw);
        //PW（高级流）按行写出字符串，自动刷新
        PrintWriter pw = new PrintWriter(bw);

        pw.println("你好");
        pw.println("再见");

        System.out.println("输出完毕");
        pw.close();


    }
}
